Send feedback on this topic.
Teradata.Client.Provider
GetChars(Int32,Int64,Char[],Int32,Int32) Method



Teradata.Client.Provider Namespace > TdDataReader Class > GetChars Method : GetChars(Int32,Int64,Char[],Int32,Int32) Method
Column ordinal (see TdDataReader.GetOrdinal).
Specifies the index within the field from which to begin the read operation.
Indicates the buffer into which to copy the field.
Specifies the index for the buffer to begin the copy operation.
Specifies the maximum number of characters to copy into the buffer.
Gets the value of the specified field (column) as a Char array.
Syntax
'Declaration
 
Public Overloads Overrides NotOverridable Function GetChars( _
   ByVal ordinal As Integer, _
   ByVal dataOffset As Long, _
   ByVal buffer() As Char, _
   ByVal bufferOffset As Integer, _
   ByVal length As Integer _
) As Long
'Usage
 
Dim instance As TdDataReader
Dim ordinal As Integer
Dim dataOffset As Long
Dim buffer() As Char
Dim bufferOffset As Integer
Dim length As Integer
Dim value As Long
 
value = instance.GetChars(ordinal, dataOffset, buffer, bufferOffset, length)
public override long GetChars( 
   int ordinal,
   long dataOffset,
   char[] buffer,
   int bufferOffset,
   int length
)
public:
int64 GetChars( 
   int ordinal,
   int64 dataOffset,
   array<char>^ buffer,
   int bufferOffset,
   int length
) override 

Parameters

ordinal
Column ordinal (see TdDataReader.GetOrdinal).
dataOffset
Specifies the index within the field from which to begin the read operation.
buffer
Indicates the buffer into which to copy the field.
bufferOffset
Specifies the index for the buffer to begin the copy operation.
length
Specifies the maximum number of characters to copy into the buffer.

Return Value

Returns the number of characters read and stored into the buffer.
Exceptions
ExceptionDescription
dataOffset is less than zero or length is less than zero or bufferOffset is less than zero or bufferOffset is greater than buffer length.
ordinal is less than zero or ordinal is equal to or greater than TdDataReader.FieldCount.
The field cannot be converted into System.Char. Note that a null field will result in an exception.
CommandBehavior is set to SchemaOnly, or there is no data for the row or column, or preceding columns are no longer accessible.
The TdDataReader is closed.
The Advanced SQL Engine returned an error, or .NET Data Provider for Teradata detected an error.
Remarks

Use this method to retrieve columns of type CHAR, VARCHAR, CLOB, JSON or XML. GetChars method supports the concept of chunking. It can be called to retrieve the field in smaller manageable chunks. For example a 10 MB CLOB field can be retrieved in 32KB chunks. The number of characters copied into the buffer can be less than the length specified.

A null buffer reference should be passed to retrieve the size of the field, as opposed to the maximum size of the column retrieved using the GetSchemaTable method.
This will return the number of bytes for an Inline CLOB or
the number of characters for a Deferred CLOB or a non-Lob column.

Requirements

Target Platforms: Windows 8.1, Windows 10, Windows Server 2012 R2, Windows Server 2016, Windows Server 2019

See Also

Reference

TdDataReader Class
TdDataReader Members
Overload List